import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import vant from 'vant'
// import { Toast } from 'vant';
import axios from 'axios'
import { get, post } from './axios/http'
import 'vant/lib/index.css';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import api from "./axios/api"
import './iconfont/iconfont.css'
import { Message } from 'element-ui';
Message.install = function (Vue, options) {
  Vue.prototype.$message = Message
}

// const vConsole = new Vconsole()
Vue.use(ElementUI);
Vue.component(Message.name, Message)
Vue.prototype.$axios = axios
Vue.config.productionTip = false,
// Vue.use(Toast);
// Vue.use(vant)
Vue.prototype.$get = get;
Vue.prototype.$post = post;
Vue.prototype.$api = api;

// Vue.component('topNav', topNav)
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')



//路由守卫
// router.beforeEach((to, from, next) => {
//   if (to.meta.requireAuth) {
//     if (JSON.parse(localStorage.getItem("phone"))) {
//       next();
//     } else {
//       next({
//         path: "/"//指向为你的登录界面
//       });
//     }
//   } else {
//     next();
//   }

//   if (to.fullPath === "/") {
//     if (JSON.parse(localStorage.getItem("phone"))) {
//       next({
//         path: from.fullPath
//       });
//     } else {
//       next();
//     }
//   }
// });